
// VS_BEGIN
#version 330 core
layout (location = 0) in vec3 aPos;
layout (location = 1) in vec2 aCoord;
layout (location = 2) in vec3 aNormal;
layout (location = 3) in vec3 aTangent;
layout (location = 4) in vec3 aBitangent;

uniform mat4 u_model;

layout (std140) uniform EngineUBO
{
    mat4 u_view;
    mat4 u_project;
    vec3 u_camPos;
};


out vec3 ViewPos;
out vec3 Normal;
out vec3 Tangent;

void main() {
    ViewPos = vec3(u_view * u_model * vec4(aPos, 1.0f));
    Normal = vec3(u_view * u_model * vec4(aNormal, 0.0f));
    Tangent = vec3(u_view * u_model * vec4(aTangent, 0.0f));
    gl_Position = u_project * u_view * u_model * vec4(aPos, 1.0f);
}
// VS_END
// FS_BEGIN
#version 330 core 
layout (location = 0) out vec3 aPosition;
layout (location = 1) out vec3 aNormal;
layout (location = 2) out vec3 aTangent;

// Light Packet:
// position.x position.y position.z type(PointLight: 0; DirectLight: 1; AmbientSphereLight: 2)
// color.r    color.g    color.b    strength
// direct.x   direct.y   direct.z   unuse
// unuse      unuse      unuse      unuse
layout (std140) uniform LightUBO
{
    mat4 u_lights[64];
    int u_lightNum;
};

layout (std140) uniform EngineUBO
{
    mat4 u_view;
    mat4 u_project;
    vec3 u_camPos;
};

uniform samplerCube u_irradianceMap; 


in vec3 ViewPos;
in vec3 Normal;
in vec3 Tangent;

out vec4 FragColor;

void main() {
    aPosition = ViewPos;
    aNormal = normalize(Normal);
    aTangent = normalize(Tangent);
}
// FS_END
